package com.example.demo.dao;

import com.example.demo.bean.Category;
import org.springframework.data.jpa.repository.EntityGraph;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @BelongsProject:springjpa_n
 * @BelongsPackage:com.example.demo.dao
 * @Author:linchong
 * @CreateTime:2020-03-30 11:28
 * @Description:分类接口
 *  2.在访问的 dao 的查询方法上面注解 @EntityGraph,value 属性值为 @NamedEntityGraph 的 name 属性值
 */
public interface CategoryRepository  extends JpaRepository<Category, String> {

	@Override
	@EntityGraph(value = "Category.Graph", type = EntityGraph.EntityGraphType.FETCH)
	List<Category> findAll();
}
